#include "test.h"


void Ladrc_b0_Identify_Curr(void)
{
	
    switch (Motor_state) {
        case IDLE:
						Encoder_Control_Init();
           PWMOutputs_ENABLE();
           Motor_state = ROTOR_ID;
            break;
        case ROTOR_ID:
							SysPara.MotorAngle=0;
							SysPara.VoltAngle= SysPara.MotorAngle;
								//Set the appropriate currentto achieve zero Angle positioning
            if (Encoder.Preset_cnt < 1000) {
                Encoder.Preset_cnt++;
                SpeedLoop.Out = 0;
								SysPara.IdRef = 5000;
               
            } else {
					//Clear the sensor pulse count
                Encoder_Cnt_Clear();
					//Start the FOC run
               Motor_state = RUN;
            }
						FOC_ExecuteAndUpdatePWM();
            break;
        case RUN:
					SpeedLoop.Out = 1000;
					SysPara.IdRef = 0;
				
				 SysPara.MotorAngle =Encoder.ElecAngle;

							Encoder_Angle_Read();

							FOC_ExecuteAndUpdatePWM();
            break;
        case STOP:
            PWMOutputs_DISABLE();
            break;
    }
}
void Ladrc_b0_Identify_Vel(void)
{
	  switch (Motor_state) 
			{
        case IDLE:
            break;
        case ROTOR_ID:
            break;
        case RUN:
            Encoder_Speed_Calc();

            break;
        case STOP:
            break;
    }
	
	
}


